package com.yangcangclub.trade.domain;

import com.yangcangclub.commons.exception.ApolloException;
import com.yangcangclub.commons.result.MessageEnum;
import com.yangcangclub.trade.base.TradeBaseDomain;
import com.yangcangclub.trade.bean.TradeResultLogs;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * Created by user on 2017/2/27.
 */
@Component
public class TradeResultLogsDomain extends TradeBaseDomain {

    public int insertTradeResultLogs(TradeResultLogs tradeResultLogs){
        super.getMasterJdbc().insert("trade.TradeResultLogsMapper.insertTradeResultLogs",tradeResultLogs);

        int id = tradeResultLogs.getId();
        if(id == 0){
            //回滚
            throw new ApolloException(MessageEnum.TRADE_RESULT_REQ_LOG_ADD_FAILURE);
        }
        return id;
    }
    public List<TradeResultLogs> selectTradeResultLogsByCondition(Map m){
        return super.getSlaveJdbc().selectList("trade.TradeResultLogsMapper.findTradeTradeResultLogsByCondition",m);
    }
}
